﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GameStudio.Common.BootStrappers;
//using Microsoft.Practices.ServiceLocation;
using Microsoft.Practices.ServiceLocation;
using Utils.EventAggregator;
using GameStudio.IDE.Common.Events;
using System.IO;
using GameStudio.Common;


namespace GameStudio.IDE.Common.Bootstrappers
{
    public class NewItemTask : IBootstrapper
    {
       
        public void Run()
        {
            var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
            eventAggregator.GetEvent<AddNewItemEvent>().Subscribe(OnItemCreated);
        }

        private void OnItemCreated(Item item)
        {
            ////save the item in the project folder
            //System.IO.Directory.CreateDirectory(Session.CurrentProject.Location);
            item.Path = System.IO.Path.Combine(
                Session.CurrentProject.Path, item.Name);
            //File.Create(item.Path);
        }
    }
}
